package com.elot.dto;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import org.springframework.stereotype.Component;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;

@Component
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class BankAccountDto {

	private Key id;
	
	private String bank; //length 4
	private String office; //length 4
	private String dc; //length 2
	private String number; //length 10 
	
	private String user;
	
	@PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	public Key getId() {
		return id;
	}
	public void setId(Key id) {
		this.id = id;
	}
	
	public BankAccountDto() {
	}
	
	public BankAccountDto(Long id, String bank, String office, String dc, String number, String user) {
		if (id!=null)
			this.id = new KeyFactory.Builder(this.getClass().getSimpleName(), id).getKey();
		this.bank = bank;
		this.office = office;
		this.dc = dc;
		this.number = number;
		this.user = user;
	}
	
	@Persistent
	public String getBank() {
		return bank;
	}
	public void setBank(String bank) {
		this.bank = bank;
	}
	
	@Persistent
	public String getOffice() {
		return office;
	}
	public void setOffice(String office) {
		this.office = office;
	}
	
	@Persistent
	public String getDc() {
		return dc;
	}
	public void setDc(String dc) {
		this.dc = dc;
	}
	
	@Persistent
	public String getNumber() {
		return number;
	}
	public void setNumber(String number) {
		this.number = number;
	}
	
	@Persistent
	public String getUser() {
		return user;
	}
	public void setUser(String user) {
		this.user = user;
	}
	
}
